/*
 * Freeswitch Modular Media Switching Software Library / Soft-Switch Application
 * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
 * Copyright (C) 2020-2023, Yantai XiaoYintao Inc.
 *
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
 *
 * The Initial Developer of the Original Code is
 * Seven Du <dujinfang@x-y-t.cn>
 * Portions created by the Initial Developer are Copyright (C)
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Seven Du <dujinfang@x-y-t.cn>
 * Kai Wang <wangkai@x-y-t.cn>
 * Chao Dong <dongchao@x-y-t.cn>
 *
 * mod_srs.h srs RTC Endpoint
 *
 */

#include <switch.h>
#include <switch_curl.h>

#ifndef __MOD_SRS_H__
#define __MOD_SRS_H__

#define MAX_BIND_EVENT 20

char *srs_version();

SWITCH_DECLARE(switch_status_t) verto_load SWITCH_MODULE_LOAD_ARGS;
SWITCH_DECLARE(switch_status_t) verto_shutdown SWITCH_MODULE_SHUTDOWN_ARGS;

typedef struct {
	char *chan_var_name;
	char *default_value;
	switch_bool_t quote;
	char *fallback_var_name;
} srs_param_t;

typedef struct srs_bind_event_s {
	char *event_name;
	char *sub_name;
} srs_bind_event_t;


typedef struct mod_srs_globals_s {
	srs_bind_event_t bind_events[MAX_BIND_EVENT];
	switch_memory_pool_t *pool;
	int debug;
	char *uuid;
	char *node_ip;
	char *node_name;
	int dial_queue;
	switch_mutex_t *sps_mutex;
	int sps_total;
	int sps;
	int running;
	switch_mutex_t *cache_mutex;

} mod_srs_globals_t;

extern mod_srs_globals_t mod_srs_globals;

#define add_current_node(json)                                              \
	do {                                                                    \
		cJSON_AddStringToObject(json, "node_uuid", mod_srs_globals.node_name); \
	} while (0)



SWITCH_DECLARE(switch_status_t) verto_answer(switch_core_session_t *session, const char *sdp);

#endif

/* For Emacs:
 * Local Variables:
 * mode:c
 * indent-tabs-mode:nil
 * tab-width:4
 * c-basic-offset:4
 * End:
 * For VIM:
 * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet expandtab:
 */
